package com.dyz.leetcode._20_dynamicProgramming._70;

import org.jcp.xml.dsig.internal.dom.ApacheTransform;

public class _70_climbStairs04 {
    //状态空间压缩
    public int climbStairs(int n) {
        if (n == 1) {return 1;}
        if (n == 2) {return 2;}
        int prev = 1;
        int curr = 2;
        for (int i = 0; i <=n ; i++) {
            int tmp = curr + prev;
            prev = curr;
            curr = tmp;
        }
        return curr;
    }
}
